﻿@model LanguageSelectorModel
@using Nop.Core;
@if (Model.AvailableLanguages.Count > 1)
{
    var webHelper = EngineContext.Current.Resolve<IWebHelper>();

    var languages = Model.AvailableLanguages.Select(lang => new SelectListItem
    {
        Text = lang.Name,
        Value = webHelper.ModifyQueryString(Url.Action("SetLanguage", "Common", new { langid = lang.Id , area = "Admin"}), "returnurl=" + HttpUtility.UrlEncode(HttpContext.Current.Request.RawUrl), null),
        Selected = lang.Id.Equals(Model.CurrentLanguage.Id)
    });

    @Html.DropDownList("customerlanguage", languages, new {onchange = "setLocation(this.value);"})
}